
import java.util.Scanner;


public class Main1162 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int[] arr_new = new int[arr.length - 1];
        int j = sc.nextInt();
        for (int i = 0, k = 0; i < arr.length; i++) {
            if (arr[i] != j) {
                arr_new[k] = arr[i];
                k++;
            }
        }
        for ( int i = 0; i < n-1; i++){
            System.out.print(arr_new[i]+ " ");
        }
    }
}
